Compare commits
2 Commits
148509831e
...
dde7db50b0
Author | SHA1 | Date |
---|---|---|
Bauke | dde7db50b0 | |
Bauke | 76505c8c1d |
|
@ -55,6 +55,7 @@
|
||||||
peek
|
peek
|
||||||
picard
|
picard
|
||||||
pkg-config
|
pkg-config
|
||||||
|
podman-compose
|
||||||
pop-icon-theme
|
pop-icon-theme
|
||||||
prismlauncher
|
prismlauncher
|
||||||
protonup-ng
|
protonup-ng
|
||||||
|
|
|
@ -89,4 +89,13 @@
|
||||||
time = {
|
time = {
|
||||||
timeZone = "Europe/Brussels";
|
timeZone = "Europe/Brussels";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtualisation = {
|
||||||
|
podman = {
|
||||||
|
enable = true;
|
||||||
|
defaultNetwork.settings = {
|
||||||
|
dns_enabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
import { runAndReturnStdout } from "./utilities.ts";
|
import { runAndReturnStdout, runCommand } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
const { options } = await new Command()
|
const { options } = await new Command()
|
||||||
|
@ -21,11 +21,11 @@ async function main(): Promise<void> {
|
||||||
|
|
||||||
if (options.install) {
|
if (options.install) {
|
||||||
const extensions = await getSavedExtensions(options.file);
|
const extensions = await getSavedExtensions(options.file);
|
||||||
await new Deno.Command("codium", {
|
await runCommand("codium", {
|
||||||
args: [
|
args: [
|
||||||
...extensions.flatMap((id) => ["--install-extension", id]),
|
...extensions.flatMap((id) => ["--install-extension", id]),
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.list) {
|
if (options.list) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
import { runAndReturnStdout } from "./utilities.ts";
|
import { runAndReturnStdout, runCommand } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
const { options } = await new Command()
|
const { options } = await new Command()
|
||||||
|
@ -27,15 +27,15 @@ async function main(): Promise<void> {
|
||||||
if (options.diff) {
|
if (options.diff) {
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const filename = file.slice(file.lastIndexOf("/") + 1);
|
const filename = file.slice(file.lastIndexOf("/") + 1);
|
||||||
await new Deno.Command("delta", {
|
await runCommand("delta", {
|
||||||
args: [`/etc/nixos/${filename}`, file],
|
args: [`/etc/nixos/${filename}`, file],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Deno.Command("sudo", {
|
await runCommand("sudo", {
|
||||||
args: [
|
args: [
|
||||||
"cp",
|
"cp",
|
||||||
"--preserve=timestamps",
|
"--preserve=timestamps",
|
||||||
|
@ -43,12 +43,12 @@ async function main(): Promise<void> {
|
||||||
...files,
|
...files,
|
||||||
"/etc/nixos/",
|
"/etc/nixos/",
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
|
|
||||||
if (options.rebuild) {
|
if (options.rebuild) {
|
||||||
await new Deno.Command("sudo", {
|
await runCommand("sudo", {
|
||||||
args: ["nixos-rebuild", options.rebuild],
|
args: ["nixos-rebuild", options.rebuild],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
|
import { runCommand } from "./utilities.ts";
|
||||||
|
|
||||||
const imagePath = new URL("../data/wallpaper.jpg", import.meta.url).pathname;
|
const imagePath = new URL("../data/wallpaper.jpg", import.meta.url).pathname;
|
||||||
|
|
||||||
|
@ -41,15 +42,15 @@ async function main(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadImage(url: string): Promise<void> {
|
async function downloadImage(url: string): Promise<void> {
|
||||||
await new Deno.Command("curl", {
|
await runCommand("curl", {
|
||||||
args: ["-fsLS", url, "-o", imagePath],
|
args: ["-fsLS", url, "-o", imagePath],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setWallpaper(file: string = imagePath): Promise<void> {
|
async function setWallpaper(file: string = imagePath): Promise<void> {
|
||||||
const monitors = ["monitorHDMI-0", "monitorHDMI-1"];
|
const monitors = ["monitorHDMI-0", "monitorHDMI-1"];
|
||||||
for (const monitor of monitors) {
|
for (const monitor of monitors) {
|
||||||
await new Deno.Command("xfconf-query", {
|
await runCommand("xfconf-query", {
|
||||||
args: [
|
args: [
|
||||||
"-c",
|
"-c",
|
||||||
"xfce4-desktop",
|
"xfce4-desktop",
|
||||||
|
@ -58,7 +59,7 @@ async function setWallpaper(file: string = imagePath): Promise<void> {
|
||||||
"-s",
|
"-s",
|
||||||
file,
|
file,
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
import { tomlFrontmatter } from "./utilities.ts";
|
import { runCommand, tomlFrontmatter } from "./utilities.ts";
|
||||||
|
|
||||||
type Frontmatter = {
|
type Frontmatter = {
|
||||||
page_title: string;
|
page_title: string;
|
||||||
|
@ -49,7 +49,7 @@ async function main(): Promise<void> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Deno.Command("youtube3", {
|
await runCommand("youtube3", {
|
||||||
args: [
|
args: [
|
||||||
"videos",
|
"videos",
|
||||||
"update",
|
"update",
|
||||||
|
@ -62,7 +62,7 @@ async function main(): Promise<void> {
|
||||||
"-r",
|
"-r",
|
||||||
`snippet.title=${title}`,
|
`snippet.title=${title}`,
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDescription(frontmatter: Frontmatter): string {
|
function formatDescription(frontmatter: Frontmatter): string {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
import { pathExists } from "./utilities.ts";
|
import { pathExists, runCommand } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
const { args, options } = await new Command()
|
const { args, options } = await new Command()
|
||||||
|
@ -30,7 +30,7 @@ async function main(): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Deno.Command("gegl", {
|
await runCommand("gegl", {
|
||||||
args: [
|
args: [
|
||||||
"-o",
|
"-o",
|
||||||
file,
|
file,
|
||||||
|
@ -42,14 +42,14 @@ async function main(): Promise<void> {
|
||||||
width: options.width,
|
width: options.width,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
|
|
||||||
if (!await pathExists(file)) {
|
if (!await pathExists(file)) {
|
||||||
console.log("Something went wrong with GEGL.");
|
console.log("Something went wrong with GEGL.");
|
||||||
Deno.exit(1);
|
Deno.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Deno.Command("convert", {
|
await runCommand("convert", {
|
||||||
args: [
|
args: [
|
||||||
file,
|
file,
|
||||||
"-background",
|
"-background",
|
||||||
|
@ -60,10 +60,10 @@ async function main(): Promise<void> {
|
||||||
`${options.width}x${options.height}`,
|
`${options.width}x${options.height}`,
|
||||||
file,
|
file,
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
|
|
||||||
if (options.clean) {
|
if (options.clean) {
|
||||||
await new Deno.Command("mat2", { args: ["--inplace", file] }).output();
|
await runCommand("mat2", { args: ["--inplace", file] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
import { runAndReturnStdout } from "./utilities.ts";
|
import { runAndReturnStdout, runCommand } from "./utilities.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
const { args } = await new Command()
|
const { args } = await new Command()
|
||||||
|
@ -24,14 +24,14 @@ async function main(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function gitPush(remote: string, args: string[]): Promise<void> {
|
async function gitPush(remote: string, args: string[]): Promise<void> {
|
||||||
await new Deno.Command("git", {
|
await runCommand("git", {
|
||||||
args: [
|
args: [
|
||||||
"push",
|
"push",
|
||||||
"--follow-tags",
|
"--follow-tags",
|
||||||
remote,
|
remote,
|
||||||
...args,
|
...args,
|
||||||
],
|
],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function gitRemote(): Promise<string[]> {
|
async function gitRemote(): Promise<string[]> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Command } from "./dependencies.ts";
|
import { Command } from "./dependencies.ts";
|
||||||
import { pathExists } from "./utilities.ts";
|
import { pathExists, runCommand } from "./utilities.ts";
|
||||||
|
|
||||||
const hiddenApi = "http://127.0.0.1:7813";
|
const hiddenApi = "http://127.0.0.1:7813";
|
||||||
const remoteApi = "http://127.0.0.1:7814/api1";
|
const remoteApi = "http://127.0.0.1:7814/api1";
|
||||||
|
@ -96,9 +96,9 @@ async function getStatus(): Promise<Status> {
|
||||||
|
|
||||||
async function notifyCurrentSong(): Promise<void> {
|
async function notifyCurrentSong(): Promise<void> {
|
||||||
const status = await getStatus();
|
const status = await getStatus();
|
||||||
await new Deno.Command("notify-send", {
|
await runCommand("notify-send", {
|
||||||
args: [status.title, status.artist],
|
args: [status.title, status.artist],
|
||||||
}).output();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.main) {
|
if (import.meta.main) {
|
||||||
|
|
|
@ -13,6 +13,16 @@ export function stringifyJsonPretty(input: unknown): string {
|
||||||
return JSON.stringify(input, null, 2);
|
return JSON.stringify(input, null, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function runCommand(
|
||||||
|
command: string,
|
||||||
|
options: Deno.CommandOptions = {
|
||||||
|
stderr: "inherit",
|
||||||
|
stdout: "inherit",
|
||||||
|
},
|
||||||
|
): Promise<void> {
|
||||||
|
await new Deno.Command(command, options).output();
|
||||||
|
}
|
||||||
|
|
||||||
export async function runAndReturnStdout(
|
export async function runAndReturnStdout(
|
||||||
command: string,
|
command: string,
|
||||||
options: Deno.CommandOptions = {},
|
options: Deno.CommandOptions = {},
|
||||||
|
|
Loading…
Reference in New Issue